home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8297 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: beach.and.nl!usenet
  2. From: jos@and.nl (Jos A. Horsmeier)
  3. Newsgroups: comp.lang.pascal.misc,comp.lang.c++,comp.lang.c,comp.lang.pascal.borland
  4. Subject: Re: Tough FACTORIAL math problem...
  5. Date: 16 Feb 1996 17:38:02 GMT
  6. Organization: AND Operations Research B.V.
  7. Message-ID: <4g2fdq$ibo@beach.and.nl>
  8. References: <4fr8be$ass@news.iconn.net> <31224679.6193@born.com> <4g00u6$gkk@sun001.spd.dsccc.com> <DMvKp5.2wL@undergrad.math.uwaterloo.ca>
  9. NNTP-Posting-Host: klepzeiker.and.nl
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <DMvKp5.2wL@undergrad.math.uwaterloo.ca>, 
  15. clgonsal@undergrad.math.uwaterloo.ca wrote:
  16. |In article <4g00u6$gkk@sun001.spd.dsccc.com>,
  17. |Mike McCarty <jmccarty@spd.dsccc.com> wrote:
  18.  
  19. |>Let's try your technique:
  20. |>
  21. |>       1! = 1 ~ 1
  22. |>       2! = 2x1! ~ 2
  23. |>       3! = 3x2! ~ 3x2 = 6
  24. |>       4! = 4x3! ~ 4x6 = 24 ~ 4
  25. |>       5! = 5x4! ~ 5x4 = 20 ~ 0
  26. |>
  27. |>You should at least think before engaging the fingers.
  28.  
  29. |Perhaps you should try *reading* before engaging the fingers. You'll notice
  30. |he said "remove all digits except the last NON-ZERO digit". So one gets:
  31. |
  32. |        1! = 1 ~ 1
  33. |        2! = 2x1! ~ 2
  34. |        3! = 3x2! ~ 3x2 = 6
  35. |        4! = 4x3! ~ 4x6 = 24 ~ 4
  36. |        5! = 5x4! ~ 5x4 = 20 ~ 2
  37. |        6! = 6x5! ~ 6x2 = 12 ~ 2
  38. |
  39. |This technique does give the correct result.
  40.  
  41. Ok, party on ...
  42.  
  43.      7! =  7x6!  ~ 7x2 = 14 ~ 4
  44.      8! =  8x7!  ~ 8x4 = 32 ~ 2
  45.      9! =  9x8!  ~ 9x2 = 18 ~ 8
  46.     10! = 10x9!  ~10x8 = 80 ~ 8
  47.     11! = 11x10! ~11x8 = 88 ~ 8
  48.     12! = 12x11! ~12x8 = 96 ~ 6
  49.     13! = 13x12! ~13x6 = 78 ~ 8
  50.     14! = 14x13! ~14x8 =112 ~ 2
  51.     15! = 15x14! ~15x2 = 30 ~ 3
  52.  
  53. erm ... 15! happens to be equal to 130764368000 ...
  54.                                            ^
  55.                                            |
  56.                                            |
  57.                                       See? see? see?
  58.  
  59. This technique does give the correct result up 'till a certain number ;-)
  60.  
  61. Jos aka jos@and.nl (the middle initial 'A' stands for 'silly')
  62.  
  63. ps. No hard feelings, I fell into this trap open eyed yesterday
  64.     and I still feel silly to the core ... ;-)
  65. -- 
  66. Atnwgqkrl gy zit vgksr, ug qshiqwtzoeqs!
  67.  
  68.